package com.suke.czx.config;

import com.aliyun.oss.OSSClient;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 应用模块名称: 配置类
 * 代码描述: 阿里云OSS配置类
 * copyright: AUZAR ALL RIGHTS RESERVED
 * company: AUZAR
 *
 * @author: 颜米晨
 * @date: 2021/09/07 15:02:08
 */
@Slf4j
@Configuration
public class OssConfig {

    /**
     * 区域节点信息
     */
    @Value("${oss.endpoint}")
    private String endpoint;

    /**
     * Access key
     */
    @Value("${oss.accessKeyId}")
    private String accessKeyId;

    /**
     * 秘钥
     */
    @Value("${oss.accessKeySecret}")
    private String accessKeySecret;

    /**
     * 初始化阿里云OSS对象
     * @return 阿里云OSS对象
     */
    @Bean
    public OSSClient ossClient() {
        return new OSSClient(endpoint, accessKeyId, accessKeySecret);
    }

}
